home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-security-randomness-01.txt < prev    next >
Text File  |  1993-10-04  |  63KB  |  1,698 lines

  1.  
  2. INTERNET-DRAFT                      Randomness Requirements for Security
  3.                                                          01 October 1993
  4.                                                    Expires 31 March 1994
  5.  
  6.  
  7.  
  8.                   Randomness Requirements for Security
  9.                   ---------- ------------ --- --------
  10.    Donald E. Eastlake 3rd, Stephen D. Crocker, & Jeffrey I. Schiller
  11.  
  12.  
  13. Status of This Document
  14.  
  15.    This draft, file name draft-ietf-security-randomness-01.txt, is
  16.    intended to be submitted to the RFC editor as an Informational RFC.
  17.    Distribution of this document is unlimited.
  18.  
  19.    This document is an Internet Draft.  Internet Drafts are working
  20.    documents of the Internet Engineering Task Force (IETF), its Areas,
  21.    its Working Groupsd and other organizations or individuals.
  22.  
  23.    Internet Drafts are draft documents valid for a maximum of six
  24.    months.  Internet Drafts may be updated, replaced, or obsoleted by
  25.    other documents at any time.  It is not appropriate to use Internet
  26.    Drafts as reference material or to cite them other than as a
  27.    ``working draft'' or ``work in progress.'' Please check the 1id-
  28.    abstracts.txt listing contained in the internet-drafts Shadow
  29.    Directories on ds.internic.net, nic.nordu.net, ftp.nisc.sri.com, or
  30.    munnari.oz.au to learn the current status of any Internet Draft.
  31.  
  32.  
  33.  
  34. Abstract
  35.  
  36.    Security systems today are built on increasingly strong cryptographic
  37.    algorithms that foil pattern analysis attempts. However, the security
  38.    of these systems is dependent on generating secret quantities for
  39.    passwords, cryptographic keys, and similar quantities.  The use of
  40.    pseudo-random processes to generate secret quantities can result in
  41.    pseudo-security.  The sophisticated attacker of these security
  42.    systems will often find it easier to reproduce the environment that
  43.    produced the secret quantities, searching the resulting small set of
  44.    possibilities, than to locate the quantities in the whole of the
  45.    number space.
  46.  
  47.    Choosing random quantities to foil a resourceful and motivated
  48.    attacker is surprisingly difficult.  This paper points out many
  49.    pitfalls in using traditional pseudo-random number generation
  50.    techniques for choosing such quantities, recommends the use of truly
  51.    random hardware techniques, provides suggestions to ameliorate the
  52.    problem when a hardware solution is not available, and gives examples
  53.    of how large such quantities need to be for some particular
  54.    applications.
  55.  
  56.  
  57. D. Eastlake, S. Crocker, & J. Schiller                          [Page 1]
  58.  
  59.  
  60. INTERNET-DRAFT                      Randomness Requirements for Security
  61.  
  62.  
  63. Acknowledgements
  64.  
  65.    Useful comments on this document that have been incorporated were
  66.    received from (in alphabetic order) the following:
  67.         David M. Balenson (TIS)
  68.         Carl Ellison (Stratus)
  69.         Marc Horowitz (MIT)
  70.         Charlie Kaufman (DEC)
  71.         Steve Kent (BBN)
  72.         Hal Murray (DEC)
  73.         Neil Haller (Bellcore)
  74.         Richard Pitkin (DEC)
  75.         Tim Redmond (TIS)
  76.         Doug Tygar (CMU)
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115. D. Eastlake, S. Crocker, & J. Schiller                          [Page 2]
  116.  
  117.  
  118. INTERNET-DRAFT                      Randomness Requirements for Security
  119.  
  120.  
  121. Table of Contents
  122.  
  123.       Status of This Document....................................1
  124.       Abstract...................................................1
  125.       Acknowledgements...........................................2
  126.       Table of Contents..........................................3
  127.       1. Introduction............................................4
  128.       2. Requirements............................................5
  129.       3. Traditional Pseudo-Random Sequences.....................7
  130.       4. Unpredictability........................................9
  131.       4.1 Problems with Clocks and Serial Numbers................9
  132.       4.2 Timing and Content of External Events.................10
  133.       4.3 The Fallacy of Complex Manipulation...................10
  134.       4.4 The Fallacy of Selection from a Large Database........11
  135.       5. Hardware for Randomness................................12
  136.       5.1 Volume Required.......................................12
  137.       5.2 Sensitivity to Skew...................................12
  138.       5.2.1 Using Stream Parity to De-Skew......................13
  139.       5.2.2 Using Transition Mappings to De-Skew................14
  140.       5.2.3 Using Compression to De-Skew........................15
  141.       5.3 Using Sound/Video Input...............................15
  142.       6. Recommended Non-Hardware Strategy......................17
  143.       6.1 Mixing Functions......................................17
  144.       6.1.1 A Trivial Mixing Function...........................17
  145.       6.1.2 Stronger Mixing Functions...........................18
  146.       6.1.3 Using a Mixing Function to Stretch Random Bits......19
  147.       6.1.4 Other Factors in Choosing a Mixing Function.........20
  148.       6.2 Non-Hardware Sources of Randomness....................20
  149.       6.3 Cryptographically Strong Sequences....................21
  150.       7. US DoD Recommendations for Password Generation.........23
  151.       8. Examples of Randomness Required........................24
  152.       8.1  Password Generation..................................24
  153.       8.2 A Very High Security Cryptographic Key................24
  154.       8.2.1 Effort per Key Trial................................25
  155.       8.2.2 Meet in the Middle Attacks..........................25
  156.       8.2.3 Other Considerations................................26
  157.       9. Security Considerations................................27
  158.       References................................................27
  159.       Authors Addresses.........................................29
  160.       Expiration and File Name..................................29
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173. D. Eastlake, S. Crocker, & J. Schiller                          [Page 3]
  174.  
  175.  
  176. INTERNET-DRAFT                      Randomness Requirements for Security
  177.  
  178.  
  179. 1. Introduction
  180.  
  181.    Software cryptography is coming into wider use.  Systems like
  182.    Kerberos, PEM, PGP, etc. are maturing and becoming a part of the
  183.    network landscape.  These systems provide substantial protection
  184.    against snooping and spoofing.  However, there is a potential flaw.
  185.    At the heart of all cryptographic systems is the generation of random
  186.    numbers.
  187.  
  188.    For the present, the lack of generally available facilities for
  189.    generating unpredictable numbers is an open wound in the design of
  190.    cryptographic software.  For the software developer who wants to
  191.    build a key or password generation procedure that runs on a wide
  192.    range of hardware, the only safe strategy so far has been to force
  193.    the local installation to supply a suitable routine to generate
  194.    unpredictable numbers.  To say the least, this is an awkward, error-
  195.    prone and unpalatable solution.
  196.  
  197.    It is important to keep in mind that the requirement is for data that
  198.    an adversary has a very low probability of guessing.  This will fail
  199.    if pseudo-random data, which only meets traditional statistical tests
  200.    for randomness or which is based on guessable range sources, such as
  201.    clocks, is used.  Frequently such random quantities are guessable by
  202.    an adversary searching through an embarrassingly small space of
  203.    possibilities.
  204.  
  205.    This informational document suggests techniques for producing random
  206.    quantities that will be resistant to such attack.  It recommends that
  207.    future systems include hardware random number generation, suggests
  208.    methods for use if such hardware is not available, and gives some
  209.    estimates of the number of random bits required for sample
  210.    applications.
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231. D. Eastlake, S. Crocker, & J. Schiller                          [Page 4]
  232.  
  233.  
  234. INTERNET-DRAFT                      Randomness Requirements for Security
  235.  
  236.  
  237. 2. Requirements
  238.  
  239.    Probably the most commonly encountered randomness requirement is the
  240.    typical user password character string.  Obviously, if a password can
  241.    be guessed, it does not provide security.  (For this particular
  242.    application it is desirable that users be able to remember the
  243.    password.  This may make it advisable to use pronounceable character
  244.    strings or phrases composed on ordinary words.  But this only affects
  245.    the format of the password information, not the requirement that the
  246.    password be very hard to guess.)
  247.  
  248.    Many other requirements come from the cryptographic arena.
  249.    Cryptographic techniques can be used to provide a variety of services
  250.    including confidentiality and authentication.  Such services are
  251.    based on quantities, traditionally called "keys", that are unknown to
  252.    and unguessable by an adversary.
  253.  
  254.    In some cases, such as the use of symmetric encryption with the one
  255.    time pads [CRYPTO*] or the US Data Encryption Standard [DES], the
  256.    parties who wish to communicate confidentially and/or with
  257.    authentication must all know the same secret key.  In other cases,
  258.    using what are called asymmetric or "public key" cryptographic
  259.    techniques, keys come in pairs.  One key of the pair is private and
  260.    must be kept secret by one party, the other is public and can be
  261.    published to the world.  It is computationally infeasible to
  262.    determine the private key from the public key.  [ASYMMETRIC, CRYPTO*]
  263.  
  264.    The frequency and volume of the requirement for random quantities
  265.    differs greatly for different cryptographic systems.  Using RSA
  266.    [CRYPTO*], random quantities are required when the key pair is
  267.    generated, but thereafter any number of messages can be signed
  268.    without any further need for randomness.  The public key Digital
  269.    Signature Algorithm that has been proposed by the US National
  270.    Institute of Standards and Technology (NIST) requires good random
  271.    numbers for each signature.  And encrypting with a one time pad, in
  272.    principle the strongest possible encryption technique, requires a
  273.    volume of randomness equal to all the messages to be processed.
  274.  
  275.    In all of these cases, an adversary may try to determine the "secret"
  276.    key by trial and error.  (This is possible as long as the key is
  277.    enough smaller than the message that the correct key can be uniquely
  278.    identified.)  The probability of an adversary succeeding at this must
  279.    be made acceptably low, depending on the particular application.  The
  280.    size of the space the adversary must search is related to the amount
  281.    of key "information" present in the information theoretic sense
  282.    [SHANNON].  This depends on the number of different secret values
  283.    possible and the probability of each value as follows:
  284.  
  285.  
  286.  
  287.  
  288.  
  289. D. Eastlake, S. Crocker, & J. Schiller                          [Page 5]
  290.  
  291.  
  292. INTERNET-DRAFT                      Randomness Requirements for Security
  293.  
  294.  
  295.                       -----
  296.                        \
  297.         Bits-of-info =  \  - p   * log  ( p  )
  298.                         /     i       2    i
  299.                        /
  300.                       -----
  301.  
  302.    where i varies from 1 to the number of possible secret values and p
  303.    sub i is the probability of the value numbered i.  (Since p sub i is
  304.    less than one, the log will be negative so each term in the sum will
  305.    be non-negative.)
  306.  
  307.    If there are 2^n different values of equal probability, then n bits
  308.    of information are present and an adversary would, on the average,
  309.    have to try half of the values, or 2^(n-1) , before guessing the
  310.    secret quantity.  If the probability of different values is unequal,
  311.    then there is less information present and fewer guesses will, on
  312.    average, be required by an adversary.  In particular, any values that
  313.    the adversary can know are impossible, or are of low probability, can
  314.    be ignored by an adversary, who will search through the more probable
  315.    values first.
  316.  
  317.    For example, consider a cryptographic system that uses 56 bit keys.
  318.    If these 56 bit keys are derived by using a pseudo-random number
  319.    generator that is seeded with an 8 bit seed, then an attacker needs
  320.    to search through only 256 keys (by running the pseudo-random number
  321.    generator with every possible seed), not the 2^56 keys that may at
  322.    first appear to be the case. Only 8 bits of "information" are in
  323.    these 56 bit keys.
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347. D. Eastlake, S. Crocker, & J. Schiller                          [Page 6]
  348.  
  349.  
  350. INTERNET-DRAFT                      Randomness Requirements for Security
  351.  
  352.  
  353. 3. Traditional Pseudo-Random Sequences
  354.  
  355.    Most traditional sources of random numbers use deterministic sources
  356.    of "pseudo-random" numbers.  These typically start with a "seed"
  357.    quantity and use numeric or logical operations to produce a sequence
  358.    of values.
  359.  
  360.    [KNUTH] has a general exposition on pseudo-random numbers.
  361.    Applications he mentions are simulation of natural phenomena,
  362.    sampling, numerical analysis, testing computer programs, decision
  363.    making, and games.  None of these have the same characteristics as
  364.    the sort of security uses we are talking about.  Only in the last two
  365.    could there be an adversary trying to find the random quantity.
  366.    However, in these cases, the adversary normally has only a single
  367.    chance to use a guessed value.  In guessing passwords or attempting
  368.    to break an encryption scheme, the adversary normally has many,
  369.    perhaps unlimited, chances at guessing the correct value and should
  370.    be assumed to be aided by a computer.
  371.  
  372.    For testing the "randomness" of numbers, Knuth suggests a variety of
  373.    measures including statistical and spectral.  These tests check
  374.    things like autocorrelation between different parts of a "random"
  375.    sequence or distribution of its values.  They could be met by a
  376.    constant stored random sequence, such as the "random" sequence
  377.    printed in the CRC Standard Mathematical Tables [CRC].
  378.  
  379.    A typical pseudo-random number generation technique, known as a
  380.    linear congruence pseudo-random number generator, is modular
  381.    arithmetic where the N+1th value is calculated from the Nth value by
  382.  
  383.         V    = ( V  * a + b )(Mod c)
  384.          N+1      N
  385.  
  386.    The above technique has a strong relationship to linear shift
  387.    register pseudo-random number generators, which are well understood
  388.    cryptographically [SHIFT*].  In such generators bits are introduced
  389.    at one end of a shift register as the Exclusive Or (binary sum
  390.    without carry) of bits from selected fixed taps into the register.
  391.    For example:
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405. D. Eastlake, S. Crocker, & J. Schiller                          [Page 7]
  406.  
  407.  
  408. INTERNET-DRAFT                      Randomness Requirements for Security
  409.  
  410.  
  411.       +----+     +----+     +----+                      +----+
  412.       | B  | <-- | B  | <-- | B  | <--  . . . . . . <-- | B  | <-+
  413.       |  0 |     |  1 |     |  2 |                      |  n |   |
  414.       +----+     +----+     +----+                      +----+   |
  415.         |                     |            |                     |
  416.         |                     |            V                  +-----+
  417.         |                     V            +----------------> |     |
  418.         V                     +-----------------------------> | XOR |
  419.         +---------------------------------------------------> |     |
  420.                                                               +-----+
  421.  
  422.  
  423.        V    = ( ( V  * 2 ) + B .xor. B ...B )(Mod 2^n)
  424.         N+1         N         0       1    n
  425.  
  426.    The goodness of traditional pseudo-random number generator algorithm
  427.    is measured by statistical tests on such sequences.  Carefully chosen
  428.    values of the initial V and a, b, and c or the placement of shift
  429.    register tap in the above simple processes can produce excellent
  430.    statistics.
  431.  
  432.    These sequences may be adequate in simulations (Monte Carlo
  433.    experiments) as long as the sequence is orthogonal to the structure
  434.    of the space being explored.  Even there, subtle patterns may cause
  435.    problems.  [ref to come - Marsaglia] However, such sequences are
  436.    clearly bad for use in security applications.  They are fully
  437.    predictable if the initial state is known.  Depending on the form of
  438.    the pseudo-random number generator, the sequence may be determinable
  439.    from observation of a short portion of the sequence.  For example,
  440.    with the generators above, one can determine V(n+1) given knowledge
  441.    of V(n).  In fact, it has been shown that with them even if only one
  442.    bit of the pseudo-random values are released, the seed can be
  443.    determined from short sequences.  [ref to come - Frieze, Hastad,
  444.    Kannan, Lagaris, & Shamir]
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463. D. Eastlake, S. Crocker, & J. Schiller                          [Page 8]
  464.  
  465.  
  466. INTERNET-DRAFT                      Randomness Requirements for Security
  467.  
  468.  
  469. 4. Unpredictability
  470.  
  471.    Randomness in the traditional sense described in the previous section
  472.    is NOT the same as the unpredictability required for security use.
  473.  
  474.    For example, use of a widely available constant sequence, such as
  475.    that from the CRC tables, is very weak against an adversary. Once
  476.    they learn of or guess it, they can easily break all security, future
  477.    and past, based on the sequence. [CRC]
  478.  
  479.  
  480.  
  481. 4.1 Problems with Clocks and Serial Numbers
  482.  
  483.    Computer clocks, or similar operating system or hardware values,
  484.    provide significantly fewer real bits of unpredictability than might
  485.    appear from their specifications.
  486.  
  487.    Tests have been done on clocks on numerous systems and it was found
  488.    that their behavior can vary widely and in unexpected ways.  One
  489.    version of an operating system running on one set of hardware may
  490.    actually provide, say, microsecond resolution in a clock while a
  491.    different configuration of the "same" system may always provide the
  492.    same lower bits and only count in the upper bits at much lower
  493.    resolution.  This means that successive reads on the clock may
  494.    produce identical values even if enough time has passed that the
  495.    value "should" change based on the nominal clock resolution. There
  496.    are also cases where frequently reading a clock can produce
  497.    artificial sequential values because of extra code that checks for
  498.    the clock being unchanged between two reads and increases it by one!
  499.    Designing portable application code to generate unpredictable numbers
  500.    based on such system clocks is particularly challenging because the
  501.    system designer does not always know the properties of the system
  502.    clocks that the code will execute on.
  503.  
  504.    Use of a hardware serial number such as an Ethernet address may also
  505.    provide fewer bits of uniqueness than one would guess.  Such
  506.    quantities are usually heavily structured and subfields may have only
  507.    a limited range of possible values or values easily guessable based
  508.    on approximate date of manufacture or other data.  For example, it is
  509.    likely that most of the Ethernet cards installed on Digital Equipment
  510.    Corporation (DEC) hardware within DEC were manufactured by DEC
  511.    itself, which significantly limits the range of possible serial
  512.    numbers.
  513.  
  514.    Problems such as those described above related to clocks and serial
  515.    numbers make code to produce unpredictable quantities difficult if
  516.    the code is to be ported across a variety of computer platforms and
  517.    systems.
  518.  
  519.  
  520.  
  521. D. Eastlake, S. Crocker, & J. Schiller                          [Page 9]
  522.  
  523.  
  524. INTERNET-DRAFT                      Randomness Requirements for Security
  525.  
  526.  
  527. 4.2 Timing and Content of External Events
  528.  
  529.    It is possible to measure the timing of mouse movement, key strokes,
  530.    and the like.  This is a reasonable source of unguessable data with
  531.    two exceptions.  On some machines, inputs such as key strokes are
  532.    buffered.  Even though the user's inter-keystroke timing may have
  533.    sufficient variation and unpredictability, there might not be an easy
  534.    way to access that variation.  The other problem is that no standard
  535.    method exists to sample timing details.  This makes it hard to build
  536.    standard software intended for distribution to a large range of
  537.    machines based on this technique.
  538.  
  539.    The  amount of mouse movement or keys actually hit are usually easier
  540.    to access than timings but may yield less unpredictability as the
  541.    user may provide highly repetative input.
  542.  
  543.  
  544.  
  545. 4.3 The Fallacy of Complex Manipulation
  546.  
  547.    One strategy which may give a misleading appearance of strength is to
  548.    take a very complex algorithm (or an excellent traditional pseudo-
  549.    random number generator with good statistical properties) and
  550.    calculate a cryptographic key by starting with the current value of a
  551.    computer system clock as the seed.  An adversary who knew roughly
  552.    when the generator was started would have a relatively small number
  553.    of seed values to test as they would know likely values of the system
  554.    clock.  Large numbers of pseudo-random bits could be generated but
  555.    the search space an adversary would need to check could be quite
  556.    small.
  557.  
  558.    Thus very strong and/or complex manipulation of data will not help if
  559.    the adversary can learn what the manipulation is and there is not
  560.    enough unpredictability in the starting seed value.
  561.  
  562.    Another serious strategy error is to assume that a very complex
  563.    pseudo-random number generation algorithm will produce strong random
  564.    numbers when there has been no theory behind or analysis of the
  565.    algorithm.  There is a excellent example of this fallacy right near
  566.    the beginning of [KNUTH] where the author describes a complex
  567.    algorithm.  It was intended that the machine language program
  568.    corresponding to the algorithm would be so complicated that a person
  569.    trying to read the code without comments wouldn't know what the
  570.    program was doing.  Unfortunately, actual use of this algorithm
  571.    showed that it almost immediately converged to a single repeated
  572.    value in one case and a small cycle of values in another case.
  573.  
  574.    Not only does complex manipulation not help you if you have a limited
  575.    range of seeds but blindly chosen complex manipulation can destroy
  576.    the randomness in a good seed!
  577.  
  578.  
  579. D. Eastlake, S. Crocker, & J. Schiller                         [Page 10]
  580.  
  581.  
  582. INTERNET-DRAFT                      Randomness Requirements for Security
  583.  
  584.  
  585. 4.4 The Fallacy of Selection from a Large Database
  586.  
  587.    Another strategy that can give a misleading appearance of strength is
  588.    selection of a quantity randomly from a database and the assumption
  589.    that its strength is related to the total number of bits in the
  590.    database.  For example, typical NNTP servers as of this date process
  591.    over 30 megabytes of information per day.  Assume a random quantity
  592.    was selected by fetching 32 bytes of data from a random starting
  593.    point in this data.  This does not yield 32*8 = 256 bits worth of
  594.    unguessability.  Even after allowing that much of the data is human
  595.    language and probably has more like 3 bits of information per byte,
  596.    it doesn't yield 32*3 = 96 bits of unguessability.  For an adversary
  597.    with access to the same 30 megabytes the unguessability rests only on
  598.    the starting point of the selection.  That is, at best, about 25 bits
  599.    of unguessability in this case.
  600.  
  601.    The same argument applies to selecting sequences from the data on a
  602.    CD ROM or Audio CD recording or any other large public database.  If
  603.    the adversary has access to the same database, this "selection from a
  604.    large volume of data" step buys very little.  However, if a selection
  605.    can be made from data to which the adversary has no access, such as
  606.    active system buffers on an active multi-user system, it may be of
  607.    some help.
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637. D. Eastlake, S. Crocker, & J. Schiller                         [Page 11]
  638.  
  639.  
  640. INTERNET-DRAFT                      Randomness Requirements for Security
  641.  
  642.  
  643. 5. Hardware for Randomness
  644.  
  645.    Is there any hope for strong portable randomness in the future?
  646.    There might be.  All that's needed is a physical source of
  647.    unpredictable numbers.
  648.  
  649.    A thermal noise or radioactive decay source and a fast, free-running
  650.    oscillator would do the trick.  This is a trivial amount of hardware,
  651.    and could easily be included as a standard part of a computer
  652.    system's architecture.  All that's needed is the common perception
  653.    among computer vendors that this small addition is necessary and
  654.    useful.
  655.  
  656.  
  657.  
  658. 5.1 Volume Required
  659.  
  660.    How much unpredictability is needed?  Is it possible to quantify the
  661.    requirement in, say, number of random bits per second?
  662.  
  663.    The answer is not very much is needed.  For DES, the key is 56 bits
  664.    and, as we show in an example in Section 8, even the highest security
  665.    system is unlikely to require a keying material of over 200 bits.
  666.    Even if a series of keys are needed, they can be generated from a
  667.    strong random seed using a cryptographically strong sequence as
  668.    explained in Section 6.3.  A few hundred random bits generated once a
  669.    day would be enough using such techniques.  Even if the random bits
  670.    are generated as slowly as one per second and it is not possible to
  671.    overlap the generation process, it should be tolerable in high
  672.    security applications to wait 200 seconds occasionally.
  673.  
  674.    These numbers are trivial to achieve.  It could be done by a person
  675.    repeatedly tossing a coin.  Almost any hardware process is likely to
  676.    be much faster.
  677.  
  678.  
  679.  
  680. 5.2 Sensitivity to Skew
  681.  
  682.    Is there any specific requirement on the shape of the distribution of
  683.    the random numbers?  The good news is the distribution need not be
  684.    uniform.  All that is needed is a conservative estimate of how non-
  685.    uniform it is to bound performance.  Two simple techniques to de-skew
  686.    the bit stream are given below and stronger techniques are mentioned
  687.    in Section 6.1.2 below.
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695. D. Eastlake, S. Crocker, & J. Schiller                         [Page 12]
  696.  
  697.  
  698. INTERNET-DRAFT                      Randomness Requirements for Security
  699.  
  700.  
  701. 5.2.1 Using Stream Parity to De-Skew
  702.  
  703.    Consider taking a sufficiently long string of bits and map the string
  704.    to "zero" or "one".  The mapping will not yield a perfectly uniform
  705.    distribution, but it can be as close as desired.  One mapping that
  706.    serves the purpose is to take the parity of the string.  This has the
  707.    advantages that it is robust across all degrees of skew up to the
  708.    estimated maximum skew and is absolutely trivial to implement in
  709.    hardware.
  710.  
  711.    The following analysis gives the number of bits that must be sampled:
  712.  
  713.    Suppose the ratio of ones to zeros is 0.5 + e : 0.5 - e, where e is
  714.    between 0 and 0.5 and is a measure of the "eccentricity" of the
  715.    distribution.  Consider the distribution of the parity function of N
  716.    bit samples.  The probabilities that the parity will be one or zero
  717.    will be the sum of the odd or even terms in the binomial expansion of
  718.    (p + q)^N, where p = 0.5 + e, the probability of a one, and q = 0.5 -
  719.    e, the probability of a zero.
  720.  
  721.    These sums can be computed easily as
  722.  
  723.         1/2 * ( ( p + q )^N + ( p - q )^N )
  724.    and
  725.         1/2 * ( ( p + q )^N - ( p - q )^N ).
  726.  
  727.    (Which one corresponds to the probability the parity will be 1
  728.    depends on whether N is odd or even.)
  729.  
  730.    Since p + q = 1 and p - q = 2e, these expressions reduce to
  731.  
  732.         1/2 * [1 + (2e)^N]
  733.    and
  734.         1/2 * [1 - (2e)^N].
  735.  
  736.    Neither of these will ever be exactly 0.5 unless e is zero, but we
  737.    can bring them arbitrarily close to 0.5.  If we want the
  738.    probabilities to be within some delta d of 0.5, i.e. then
  739.  
  740.         ( 0.5 + ( 0.5 * (2e)^N ) ) < 0.5 + d.
  741.  
  742.    Solving for N yields N > log(2d)/log(2e).  (Note that 2e is less than
  743.    1, so its log is negative.  Division by a negative number reverses
  744.    the sense of an inequality.)
  745.  
  746.    The following table gives the length of the string which must be
  747.    sampled for various degrees of skew in order to come within 0.001 of
  748.    a 50/50 distribution.
  749.  
  750.  
  751.  
  752.  
  753. D. Eastlake, S. Crocker, & J. Schiller                         [Page 13]
  754.  
  755.  
  756. INTERNET-DRAFT                      Randomness Requirements for Security
  757.  
  758.  
  759.                        +---------+--------+-------+
  760.                        | Prob(1) |    e   |    N  |
  761.                        +---------+--------+-------+
  762.                        |   0.5   |  0.00  |    1  |
  763.                        |   0.6   |  0.10  |    4  |
  764.                        |   0.7   |  0.20  |    7  |
  765.                        |   0.8   |  0.30  |   13  |
  766.                        |   0.9   |  0.40  |   28  |
  767.                        |   0.95  |  0.45  |   59  |
  768.                        |   0.99  |  0.49  |  308  |
  769.                        +---------+--------+-------+
  770.  
  771.    The last entry shows that even if the distribution is skewed 99% in
  772.    favor of ones, the parity of a string of 308 samples will be within
  773.    0.001 of a 50/50 distribution.
  774.  
  775.  
  776.  
  777. 5.2.2 Using Transition Mappings to De-Skew
  778.  
  779.    Another possible technique is to examine a bit stream as a sequence
  780.    of non-overlapping pairs. You could then discard any 00 or 11 pairs
  781.    found, interpret 01 as a 0 and 10 as a 1.  Assume the probability of
  782.    a 1 is 0.5+e and the probability of a 0 is 0.5-e where e is the
  783.    eccentricity of the source and described in the previous section.
  784.    Then the probability of each pair is as follows:
  785.  
  786.             +------+-----------------------------------------+
  787.             | pair |            probability                  |
  788.             +------+-----------------------------------------+
  789.             |  00  | (0.5 - e)^2          =  0.25 - e + e^2  |
  790.             |  01  | (0.5 - e)*(0.5 + e)  =  0.25     - e^2  |
  791.             |  10  | (0.5 + e)*(0.5 - e)  =  0.25     - e^2  |
  792.             |  11  | (0.5 + e)^2          =  0.25 + e + e^2  |
  793.             +------+-----------------------------------------+
  794.  
  795.    This technique will completely eliminate any bias but at the expense
  796.    of taking an indeterminate number of input bits for any particular
  797.    desired number of output bits.  The probability of any particular
  798.    pair being discarded is 0.5 + 2e^2 so the expected number of input
  799.    bits to produce X output bits is X/(0.25 - e^2).
  800.  
  801.    This technique assumes that the bits are from a stream where each bit
  802.    has the same probability of being a 0 or 1 as any other bit in the
  803.    stream and that bits are not correlated, i.e., that the bits are
  804.    identical independent distributions.  If alternate bits were from two
  805.    different sources, for example, the above analysis breaks down.
  806.  
  807.    The above technique also provides another illustration of how a
  808.    simple statistical analysis can mislead if one is not always on the
  809.  
  810.  
  811. D. Eastlake, S. Crocker, & J. Schiller                         [Page 14]
  812.  
  813.  
  814. INTERNET-DRAFT                      Randomness Requirements for Security
  815.  
  816.  
  817.    lookout for patterns that could be exploited by an adversary.  If the
  818.    algorithm were mis-read slightly so that overlapping successive bits
  819.    pairs were used instead of non-overlapping pairs, the statistical
  820.    analysis given is the same; however, instead of provided an unbiased
  821.    uncorrelated series of random 1's and 0's, it would instead produce a
  822.    totally predictable sequence of exactly alternating 1's and 0's.
  823.  
  824.  
  825.  
  826. 5.2.3 Using Compression to De-Skew
  827.  
  828.    Reversible compression techniques also provide a crude method of de-
  829.    skewing a skewed bit stream.  This follows directly from the
  830.    definition of reversible compression and the formula in Section 2
  831.    above for the amount of information in a sequence.  Since the
  832.    compression is reversible, the same amount of information must be
  833.    present in the shorter output than was present in the longer input.
  834.    By the Shannon information equation, this is only possible if, on
  835.    average, the probabilities of the different shorter sequences are
  836.    more uniformly distributed than were the probabilities of the longer
  837.    sequences.  Thus the shorter sequences are de-skewed relative to the
  838.    input.
  839.  
  840.    However, many compression techniques add a somewhat predicatable
  841.    preface to their output stream and may insert such a sequence again
  842.    periodically in their output or otherwise introduce subtle patterns
  843.    of their own.  They should be considered only a rough technique
  844.    compared with those described above or in Section 6.1.2.  At a
  845.    minimum, the beginning of the compressed sequence should be skipped
  846.    and only later bits used for applications requiring random bits.
  847.  
  848.  
  849.  
  850. 5.3 Using Sound/Video Input
  851.  
  852.    Increasingly computers are being built with inputs that digitize some
  853.    real world analog source, such as sound from a microphone or video
  854.    input from a camera.  Under appropriate circumstances, such input can
  855.    provide reasonably high quality random bits.  The "input" from a
  856.    sound digitizer with no source plugged in or a camera with the lens
  857.    cap on, if the system is high enough gain to detect anything, is
  858.    essentially thermal noise.
  859.  
  860.    For example, on a Sparkstation, one can read from the /dev/audio
  861.    device with nothing plugged into the microphone jack.  Such data is
  862.    essentially random noise although it should not be trusted without
  863.    some checking in case of hardware failure.  It will, in any case,
  864.    need to be de-skewed as described elsewhere.
  865.  
  866.    Thus, combining this with compression to de-skew, one can in UNIXese
  867.  
  868.  
  869. D. Eastlake, S. Crocker, & J. Schiller                         [Page 15]
  870.  
  871.  
  872. INTERNET-DRAFT                      Randomness Requirements for Security
  873.  
  874.  
  875.    generate a hugh amount of relatively random data by doing
  876.  
  877.         cat /dev/audio | compress - >random-bits-file
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927. D. Eastlake, S. Crocker, & J. Schiller                         [Page 16]
  928.  
  929.  
  930. INTERNET-DRAFT                      Randomness Requirements for Security
  931.  
  932.  
  933. 6. Recommended Non-Hardware Strategy
  934.  
  935.    What is the best overall strategy for meeting the requirement for
  936.    unguessable random numbers in the absence of a reliable hardware
  937.    source?  It is to obtain random input from a large number of
  938.    uncorrelated sources and to mix them with a strong mixing function.
  939.    Such a function will preserve the randomness present in any of the
  940.    sources even if other quantities being combined are fixed or easily
  941.    guessable.  This may be advisable even with a good hardware source as
  942.    hardware can also fail, though this should be weighed against any
  943.    increase in the chance of overall failure due to added software
  944.    complexity.
  945.  
  946.  
  947.  
  948. 6.1 Mixing Functions
  949.  
  950.    A strong mixing function is one which combines two or more inputs and
  951.    produces an output where each output bit is a different complex non-
  952.    linear function of all the input bits.  On average, changing any
  953.    input bit will change about half the output bits.  But because the
  954.    relationship is complex and non-linear, no particular output bit is
  955.    guaranteed to change when any particular input bit is changed.
  956.  
  957.    Note that the problem of converting a stream of bits that is skewed
  958.    towards 0 or 1 to a shorter stream which is more random, as discussed
  959.    in Section 5.2 above, is simply another case where a strong mixing
  960.    function is desired.  The technique given in Section 5.2.1 of using
  961.    the parity of a number of bits is simply the result of successively
  962.    Exclusive Or'ing them which is examined as a trivial mixing function
  963.    immediately below.  Use of stronger mixing functions to extract more
  964.    of the randomness in a stream of skewed bits is examined in Section
  965.    6.1.2.
  966.  
  967.  
  968.  
  969. 6.1.1 A Trivial Mixing Function
  970.  
  971.    A trivial example for single bit inputs is the Exclusive Or function,
  972.    which is equivalent to addition without carry, as show in the table
  973.    below.  This is a degenerate case in which the one output bit always
  974.    changes for a change in either input bit but it will still provide a
  975.    useful illustration.
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985. D. Eastlake, S. Crocker, & J. Schiller                         [Page 17]
  986.  
  987.  
  988. INTERNET-DRAFT                      Randomness Requirements for Security
  989.  
  990.  
  991.                    +-----------+-----------+----------+
  992.                    |  input 1  |  input 2  |  output  |
  993.                    +-----------+-----------+----------+
  994.                    |     0     |     0     |     0    |
  995.                    |     0     |     1     |     1    |
  996.                    |     1     |     0     |     1    |
  997.                    |     1     |     1     |     0    |
  998.                    +-----------+-----------+----------+
  999.  
  1000.    If inputs 1 and 2 are uncorrelated and combined in this fashion then
  1001.    the output will be an even better (less skewed) random bit than the
  1002.    inputs.  If we assume an "eccentricity" e as defined in Section 5.2
  1003.    above, then the output eccentricity relates to the input eccentricity
  1004.    as follows:
  1005.  
  1006.         e       = 2 * e        * e
  1007.          output        input 1    input 2
  1008.  
  1009.    Since e is never greater than 1/2, the eccentricity is always
  1010.    improved except in the case where at least one input is a totally
  1011.    skewed constant.  This is illustrated in the following table where
  1012.    the top and left side values are the two input eccentricities and the
  1013.    entries are the output eccentricity:
  1014.  
  1015.      +--------+--------+--------+--------+--------+--------+--------+
  1016.      |    e   |  0.00  |  0.10  |  0.20  |  0.30  |  0.40  |  0.50  |
  1017.      +--------+--------+--------+--------+--------+--------+--------+
  1018.      |  0.00  |  0.00  |  0.00  |  0.00  |  0.00  |  0.00  |  0.00  |
  1019.      |  0.10  |  0.00  |  0.02  |  0.04  |  0.06  |  0.08  |  0.10  |
  1020.      |  0.20  |  0.00  |  0.04  |  0.08  |  0.12  |  0.16  |  0.20  |
  1021.      |  0.30  |  0.00  |  0.06  |  0.12  |  0.18  |  0.24  |  0.30  |
  1022.      |  0.40  |  0.00  |  0.08  |  0.16  |  0.24  |  0.32  |  0.40  |
  1023.      |  0.50  |  0.00  |  0.10  |  0.20  |  0.30  |  0.40  |  0.50  |
  1024.      +--------+--------+--------+--------+--------+--------+--------+
  1025.  
  1026.    However, keep in mind that the above calculations assume that the
  1027.    inputs are not correlated.  If the inputs were, say, the parity of
  1028.    the number of minutes from midnight on two clocks accurate to a few
  1029.    seconds, then each might appear random if sampled at random intervals
  1030.    much longer than a minute.  Yet if they were both sampled and
  1031.    combined with xor, the result would usually be a constant zero.
  1032.  
  1033.  
  1034.  
  1035. 6.1.2 Stronger Mixing Functions
  1036.  
  1037.    The US Government Data Encryption Standard [DES] is a good example of
  1038.    a strong mixing function for multiple bit quantities.  It takes up to
  1039.    120 bits of input (64 bits of "data" and 56 bits of "key") and
  1040.    produces 64 bits of output each of which is dependent on a complex
  1041.  
  1042.  
  1043. D. Eastlake, S. Crocker, & J. Schiller                         [Page 18]
  1044.  
  1045.  
  1046. INTERNET-DRAFT                      Randomness Requirements for Security
  1047.  
  1048.  
  1049.    non-linear function of all input bits.  Another good family of mixing
  1050.    functions are the "message digest" or hashing functions such as MD2,
  1051.    MD4, or MD5 that take an arbitrary amount of input and produce an
  1052.    output, frequently 128 bits, mixing all the input bits. [MD2, MD4,
  1053.    MD5]
  1054.  
  1055.    Although message digest functions like MD5 are designed for variable
  1056.    amounts of input, DES can also be used to combine any number of
  1057.    inputs.  If 64 bits of output is adequate, the inputs can be packed
  1058.    into a 64 bit data quantity and successive 56 bit keys, padding with
  1059.    zeros if needed, which are then used to successively encrypt using
  1060.    DES in Electronic Codebook Mode [DES MODES].  If more than 64 bits of
  1061.    output are needed, use more complex mixing.  For example, if inputs
  1062.    are packed into three quantities, A, B, and C, use DES to encrypt A
  1063.    with B as a key and then with C as a key to produce the 1st part of
  1064.    the output, then encrypt B with C and then A for more output and, if
  1065.    necessary, encrypt C with A and then B for yet more output.  Still
  1066.    more output can be produced by reversing the order of the keys given
  1067.    above to stretch things, but keep in mind that it is impossible to
  1068.    get more bits of "randomness" out than are put in.
  1069.  
  1070.    An example of using a strong mixing function would be to reconsider
  1071.    the case of a string of 308 bits each of which is biased 99% towards
  1072.    zero.  The parity technique given in Section 5.2.1 above reduced this
  1073.    to one bit with only a 1/1000 deviance from being equally likely a
  1074.    zero or one.  But, applying the equation for information given in
  1075.    Section 2, this 308 bit sequence has 5 bits of information in it.
  1076.    Thus hashing it with MD5 and taking the bottom 5 bits of the result
  1077.    would yield 5 unbiased random bits as opposed to the single bit given
  1078.    by calculating the parity of the string.
  1079.  
  1080.    Other functions besides DES and the MD* family should serve well as
  1081.    mixing functions.  This is an advantage of Diffie-Hellman exponential
  1082.    key exchange.  Diffie-Hellman yields a shared secret between two
  1083.    parties that is a mixture of initial random quantities generated by
  1084.    each of them [D-H, ref to come - Odlyzko].
  1085.  
  1086.  
  1087.  
  1088. 6.1.3 Using a Mixing Function to Stretch Random Bits
  1089.  
  1090.    While it is not necessary for a mixing function to produce the same
  1091.    or fewer bits than its inputs, mixing bits cannot "stretch" the
  1092.    amount of random unpredictability present in the inputs.  Thus four
  1093.    inputs of 32 bits each where there is 12 bits worth of
  1094.    unpredicatability (such as 4,096 equally probable values) in each
  1095.    input cannot produce more than 48 bits worth of unpredictable output.
  1096.    The output can be expanded to hundreds or thousands of bits by, for
  1097.    example, mixing with successive integers, but the clever adversary's
  1098.    search space is still 2^48 possibilities.  Furthermore, mixing to
  1099.  
  1100.  
  1101. D. Eastlake, S. Crocker, & J. Schiller                         [Page 19]
  1102.  
  1103.  
  1104. INTERNET-DRAFT                      Randomness Requirements for Security
  1105.  
  1106.  
  1107.    fewer bits than are input will tend to strengthen the randomness of
  1108.    the output the way using Exclusive Or to produce one bit from two did
  1109.    above.
  1110.  
  1111.    The last table in Section 6.1.1 shows that mixing a random bit with a
  1112.    constant bit with Exclusive Or will produce a random bit.  While this
  1113.    is true, it does not provide a way to "stretch" one random bit into
  1114.    more than one.  If, for example, a random bit is mixed with a 0 and
  1115.    then with a 1, this produces a two bit sequence but it will always be
  1116.    either 01 or 10.  Since there are only two possible values, there is
  1117.    still only the one bit of original randomness.
  1118.  
  1119.  
  1120.  
  1121. 6.1.4 Other Factors in Choosing a Mixing Function
  1122.  
  1123.    For local use, DES has the advantages that it has been widely tested
  1124.    for flaws, is widely documented, and is widely implemented with
  1125.    hardware and software implementations available all over the world
  1126.    including source code available by anonymous FTP.  The MD* family are
  1127.    younger algorithms which have been less tested but there is no
  1128.    particular reason to believe they are flawed.  They also have source
  1129.    code available by anonymous FTP [MD2, MD4, MD5].  DES, MD4, and MD5
  1130.    are royalty free for all purposes but MD2 has been freely licensed
  1131.    only for non-profit use in connection with Privacy Enhanced Mail.
  1132.    Some people believe that, as with Goldilocks and the Three Bears, MD2
  1133.    is strong but too slow, MD4 is fast but too weak, and MD5 is just
  1134.    right.
  1135.  
  1136.    Another advantage of the MD* or similar hashing algorithms is that
  1137.    they are not subject to the regulations imposed by the US Government
  1138.    prohibiting the export or import of encryption/decryption software
  1139.    (or hardware).  The same should be true of DES rigged to produce an
  1140.    irreversible hash code but most DES packages are oriented to
  1141.    reversible encryption.
  1142.  
  1143.  
  1144.  
  1145. 6.2 Non-Hardware Sources of Randomness
  1146.  
  1147.    The best source of input for mixing would be a hardware random number
  1148.    generator based on some fundamentally random physical process such as
  1149.    thermal noise or radioactive decay.  However, if that is not
  1150.    available, other possibilities include system clocks, system or
  1151.    input/output buffers, user/system/hardware/network serial numbers
  1152.    and/or addresses, user input, and timings of input/output operations.
  1153.    Unfortunately, any of these sources can produce limited or
  1154.    predicatable values under some circumstances.
  1155.  
  1156.    Some of the sources listed above would be quite strong on multi-user
  1157.  
  1158.  
  1159. D. Eastlake, S. Crocker, & J. Schiller                         [Page 20]
  1160.  
  1161.  
  1162. INTERNET-DRAFT                      Randomness Requirements for Security
  1163.  
  1164.  
  1165.    systems where, in essence, each user of the system is a source of
  1166.    randomness.  However, on a small single user system, such as a
  1167.    typical IBM PC or Apple Macintosh, it might be possible for an
  1168.    adversary to assemble a similar configuration.  This could give the
  1169.    adversary inputs to the mixing process that were sufficiently
  1170.    correlated to those used originally as to make exhaustive search
  1171.    practical.
  1172.  
  1173.    The use of multiple random inputs with a strong mixing function is
  1174.    recommended and can overcome weakness in any particular input.  For
  1175.    example, the timing and content of requested "random" user keystrokes
  1176.    can yield hundreds of random bits but conservative assumptions need
  1177.    to be made.  For example, assuming a few bits of randomness if the
  1178.    inter-keystroke interval is unique in the sequence up to that point
  1179.    and a similar assumption if the key hit is unique but assuming that
  1180.    no bits of randomness are present in the initial key value or if the
  1181.    timing or key value duplicate previous values.  The results of mixing
  1182.    these timings and characters typed could be further combined with
  1183.    clock values and other inputs.
  1184.  
  1185.    This strategy may make practical portable code to produce good random
  1186.    numbers for security even if some of the inputs are very weak on some
  1187.    of the target systems.  However, it may fail against a high grade
  1188.    attack on small single user systems, especially if the adversary has
  1189.    even been able to observe the generation process in the past.  A
  1190.    hardware random source is still preferable.
  1191.  
  1192.  
  1193.  
  1194. 6.3 Cryptographically Strong Sequences
  1195.  
  1196.    In cases where a series of random quantities must be generated, an
  1197.    adversary may learn some values in the sequence.  In general, they
  1198.    should not be able to predict other values from the ones that they
  1199.    know.
  1200.  
  1201.    The correct technique is to start with a strong random seed, take
  1202.    cryptographically strong steps from that seed [CRYPTO2], and do not
  1203.    reveal the complete state of the generator in the sequence elements.
  1204.    If each value in the sequence can be calculated in a fixed way from
  1205.    the previous value, then when any value is compromised, all future
  1206.    values can be determined.  This would be the case, for example, if
  1207.    each value were a constant function of the previous values, even if
  1208.    the function were a very strong, non-invertible message digest
  1209.    function.
  1210.  
  1211.    A good way to achieve a strong sequence is to have the values be
  1212.    produced by hashing the quantities produced by concatenating the seed
  1213.    with successive integers or the like and then mask the values
  1214.    obtained so as to limit the amount of generator state available to
  1215.  
  1216.  
  1217. D. Eastlake, S. Crocker, & J. Schiller                         [Page 21]
  1218.  
  1219.  
  1220. INTERNET-DRAFT                      Randomness Requirements for Security
  1221.  
  1222.  
  1223.    the adversary.  It may also be possible to use an encryption
  1224.    algorithm with a random key and seed value to encrypt and feedback
  1225.    some of the output encrypted value into the value to be encrypted for
  1226.    the next iteration.  Appropriate feedback techniques will usually be
  1227.    recommended with the encryption algorithm.  An example is shown below
  1228.    where shifting and masking are used to combine the cypher output
  1229.    feedback.  This type of feedback is recommended in connection with
  1230.    DES [DES MODES].
  1231.  
  1232.          +---------------+
  1233.          |       V       |
  1234.          |  |     n      |
  1235.          +--+------------+
  1236.                |      |           +---------+
  1237.                |      +---------> |         |      +-----+
  1238.             +--+                  | Encrypt | <--- | Key |
  1239.             |           +-------- |         |      +-----+
  1240.             |           |         +---------+
  1241.             V           V
  1242.          +------------+--+
  1243.          |      V     |  |
  1244.          |       n+1     |
  1245.          +---------------+
  1246.  
  1247.    Note that if a shift of one is used, this is the same as the shift
  1248.    register technique described in Section 3 above but with the all
  1249.    important difference that the feedback is determined by a complex
  1250.    non-linear function of all bits rather than a simple linear
  1251.    combination of output from a few bit position taps.
  1252.  
  1253.    To predict values of a sequence from others when the sequence was
  1254.    generated by these techniques is equivalent to breaking the
  1255.    cryptosystem or inverting the "non-invertible" hashing involved with
  1256.    only partial information available.  The less information revealed
  1257.    each iteration, the harder it will be for an adversary to predict the
  1258.    sequence.  Thus it is best to use only one bit from each value.  It
  1259.    has been shown that some cases this makes it impossible to break a
  1260.    system even when the cryptographic system is invertible and can be
  1261.    broken if all of the generated values were revealed.
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275. D. Eastlake, S. Crocker, & J. Schiller                         [Page 22]
  1276.  
  1277.  
  1278. INTERNET-DRAFT                      Randomness Requirements for Security
  1279.  
  1280.  
  1281. 7. US DoD Recommendations for Password Generation
  1282.  
  1283.    The United States Department of Defense has specific recommendations
  1284.    for password generation [DoD]. They suggest using the US Data
  1285.    Encryption Standard [DES] in Output Feedback Mode [DES MODES] as
  1286.    follows:
  1287.  
  1288.         use an initialization vector determined from
  1289.              the system clock,
  1290.              system ID,
  1291.              user ID, and
  1292.              date and time;
  1293.         use a key determined from
  1294.              system interrupt registers,
  1295.              system status registers, and
  1296.              system counters; and,
  1297.         as plain text, use an external randomly generated 64 bit
  1298.         quantity such as 8 characters typed in by a system
  1299.         administrator.
  1300.  
  1301.    The password can then be calculated from the 64 bit "cipher text"
  1302.    generated in 64-bit Output Feedback Mode.  As many bits as are needed
  1303.    can be taken from these 64 bits and expanded into a pronounceable
  1304.    word, phrase, or other format.
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333. D. Eastlake, S. Crocker, & J. Schiller                         [Page 23]
  1334.  
  1335.  
  1336. INTERNET-DRAFT                      Randomness Requirements for Security
  1337.  
  1338.  
  1339. 8. Examples of Randomness Required
  1340.  
  1341.    Below are two examples showing rough calculations of needed
  1342.    randomness for security.
  1343.  
  1344.  
  1345.  
  1346. 8.1  Password Generation
  1347.  
  1348.    Assume that user passwords change once a year and a probability of
  1349.    less than one in a thousand that an adversary could guess the
  1350.    password for a particular account is desired.  The key question is
  1351.    how often they can try possibilities.  Assume that delays have been
  1352.    introduced into a system so that, at most, an adversary can make one
  1353.    password try every six seconds.  That's 600 per hour or about 15,000
  1354.    per day or about 5,000,000 tries in a year.  Assuming any sort of
  1355.    monitoring, it is unlikely someone could actually try continuously
  1356.    for a year.  In fact, even if log files are only checked monthly,
  1357.    500,000 tries is more plausible before the attack is noticed and
  1358.    steps taken to change passwords and make it harder to try more
  1359.    passwords.  (All this assumes that sending a password to the system
  1360.    is the only way to try a password.)
  1361.  
  1362.    To have a one in a thousand chance of guessing the password in
  1363.    500,000 tries implies a universe of at least 500,000,000 passwords or
  1364.    about 2^29.  Thus 29 bits of randomness are needed. This can probably
  1365.    be achieved using the US DoD recommended inputs for password
  1366.    generation as it has 8 inputs which probably average over 5 bits of
  1367.    randomness each.  Using a list of 1000 words, the password could be
  1368.    expressed as a three word phrase (1,000,000,000 possibilities) or,
  1369.    using case insensitive letters and digits, six would suffice
  1370.    ((26+10)^6 = 2,176,782,336 possibilities).
  1371.  
  1372.    For a higher security password, the number of bits required goes up.
  1373.    To decrease the probability by 1,000 requires increasing the universe
  1374.    of passwords by the same factor which adds about 12 bits.  Thus to
  1375.    have only a one in a million chance of a password being guessed under
  1376.    the above scenario would require 31 bits of randomness and a password
  1377.    that was a four word phrase from a 1000 word list or eight
  1378.    letters/digits.  To go to a one in 10^9 chance, 43 bits of randomness
  1379.    are needed implying a five word phrase or ten letter/digit password.
  1380.  
  1381.  
  1382.  
  1383. 8.2 A Very High Security Cryptographic Key
  1384.  
  1385.    Assume that a very high security key is needed for symmetric
  1386.    encryption / decryption between two parties.  Assume an adversary can
  1387.    observe communications and knows the algorithm being used.  Within
  1388.    the field of random possibilities, the adversary can exhaustively try
  1389.  
  1390.  
  1391. D. Eastlake, S. Crocker, & J. Schiller                         [Page 24]
  1392.  
  1393.  
  1394. INTERNET-DRAFT                      Randomness Requirements for Security
  1395.  
  1396.  
  1397.    key values.  Assume further that there is no systematic weakness in
  1398.    the cryptographic system so that brute force trial of keys is the
  1399.    best the adversary can do.
  1400.  
  1401.  
  1402.  
  1403. 8.2.1 Effort per Key Trial
  1404.  
  1405.    How much effort will it take to try each key?  For very high security
  1406.    applications it is best to assume a low value of effort.  Even if it
  1407.    would clearly take tens of thousands of computer cycles or more to
  1408.    try a single key, there may be some pattern that enables huge blocks
  1409.    of key values to be tested with much less effort per key.  Thus it is
  1410.    probably best to assume no more than a hundred cycles per key.
  1411.    (There is no clear lower bound on this as computers operate in
  1412.    parallel on a number of bits and a poor encryption algorithm could
  1413.    allow many keys or even groups of keys to be tested in parallel.
  1414.    However, we need to assume some value and can hope that a reasonably
  1415.    strong algorithm has been chosen for our hypothetical high security
  1416.    task.)
  1417.  
  1418.    If the adversary can command a highly parallel processor or a large
  1419.    network of work stations, 10^10 cycles per second is probably a
  1420.    minimum assumption for availability today.  Looking forward just a
  1421.    few years, there should be at least an order of magnitude
  1422.    improvement.  Thus assuming 10^9 keys could be checked per second or
  1423.    3.6*10^11 per hour or 6*10^13 per week or 2.4*10^14 per month is
  1424.    reasonable.  This implies a need for a minimum of 48 bits of
  1425.    randomness in keys to be sure they cannot be found in a week.  Even
  1426.    then it is possible that, a few years from now, a highly determined
  1427.    and resourceful adversary could break the key in 2 weeks (on average
  1428.    they need try only half the keys).
  1429.  
  1430.  
  1431.  
  1432. 8.2.2 Meet in the Middle Attacks
  1433.  
  1434.    If chosen or known plain text and the resulting encrypted text are
  1435.    available, a "meet in the middle" attack is possible if the structure
  1436.    of the encryption algorithm allows it.  (In a known plain text
  1437.    attack, the adversary knows all or part of the messages being
  1438.    encrypted, possibly some standard header or trailer fields.  In a
  1439.    chosen plain text attack, the adversary can force some known plain
  1440.    text to be encrypted, possibly by "leaking" an exciting text that
  1441.    would then be sent by the adversary over an encrypted channel.)
  1442.  
  1443.    An oversimplified explanation of the meet in the middle attack attack
  1444.    is as follows: the adversary can half-encrypt the know or chosen
  1445.    plain text with all possible first half-keys, sort these, then half-
  1446.    decrypt the encoded text with all the second half-keys.  If a match
  1447.  
  1448.  
  1449. D. Eastlake, S. Crocker, & J. Schiller                         [Page 25]
  1450.  
  1451.  
  1452. INTERNET-DRAFT                      Randomness Requirements for Security
  1453.  
  1454.  
  1455.    is found, the full key can be assembled from the halves and used to
  1456.    decrypt other parts of the message or other messages.  At its best,
  1457.    this type of attack can halve the exponent of the work required by
  1458.    the adversary while adding a moderate constant factor.  To be assured
  1459.    of safety against this, a doubling of the amount of randomness in the
  1460.    key to a minimum of 96 bits is required.
  1461.  
  1462.    The meet in the middle attack assumes that the cryptographic
  1463.    algorithm can be decomposed in this way but we can not rule that out
  1464.    without a deep knowledge of the algorithm.  Even if a basic algorithm
  1465.    is not subject to a meet in the middle attack, an attempt to produce
  1466.    a stronger algorithm by applying the basic algorithm twice with
  1467.    different keys may gain much less than would be expected.  Such a
  1468.    composite algorithm would be subject to this type of attack.
  1469.  
  1470.    Enormous resources may be required to mount a meet in the middle
  1471.    attack but they are probably within the range of the national
  1472.    security services of a major nation.  Almost all nations spy on other
  1473.    nations government traffic and some nations are known to spy on
  1474.    commercial traffic and give the information to their domestic
  1475.    companies to assist them against foreign competition.
  1476.  
  1477.  
  1478.  
  1479. 8.2.3 Other Considerations
  1480.  
  1481.    Since we have not even considered the possibilities of special
  1482.    purpose code breaking hardware or just how much of a safety margin we
  1483.    want beyond our assumptions above, probably a good minimum for a very
  1484.    high security cryptographic key is 128 bits of randomness which
  1485.    implies a minimum key length of 128 bits.  If the two parties agree
  1486.    on a key by Diffie-Hellman exchange [D-H], then in principle only
  1487.    half of this randomness would have to be supplied by each party.
  1488.    However, there is probably some correlation between their random
  1489.    inputs so it is probably best to assume that each party needs to
  1490.    provide at least 96 bits worth of randomness for very high security.
  1491.  
  1492.    This amount of randomness is probably beyond the limit of that in the
  1493.    inputs recommended by the US DoD for password generation and could
  1494.    require user typing timing, hardware random number generation, or
  1495.    other sources.
  1496.  
  1497.    It should be noted that key length calculations such at those above
  1498.    are controversial and depend on various assumptions about the
  1499.    cryptographic algorithms in use.  In some cases, a professional with
  1500.    a deep knowledge of code breaking techniques and of the strength of
  1501.    the algorithm in use could be satisfied with less than half of the
  1502.    key size derived above.
  1503.  
  1504.  
  1505.  
  1506.  
  1507. D. Eastlake, S. Crocker, & J. Schiller                         [Page 26]
  1508.  
  1509.  
  1510. INTERNET-DRAFT                      Randomness Requirements for Security
  1511.  
  1512.  
  1513. 9. Security Considerations
  1514.  
  1515.    The entirety of this draft concerns techniques and recommendations
  1516.    for generating "random" quantities for use as passwords,
  1517.    cryptographic keys, and similar security uses.
  1518.  
  1519.  
  1520.  
  1521. References
  1522.  
  1523.    [ASYMMETRIC] - Secure Communications and Asymmetric Cryptosystems,
  1524.    edited by Gustavus J. Simmons, AAAS Selected Symposium 69, Westview
  1525.    Press, Inc.
  1526.  
  1527.    [CRC] - C.R.C. Standard Mathematical Tables, Chemical Rubber
  1528.    Publishing Company.
  1529.  
  1530.    [CRYPTO1] - Cryptography:  A Primer, by Alan G. Konheim, A Wiley-
  1531.    Interscience Publication, John Wiley & Sons, 1981, Alan G. Konheim.
  1532.  
  1533.    [CRYPTO2] - Cryptography:  A New Dimension in Computer Data Security,
  1534.    A Wiley-Interscience Publication, John Wiley & Sons, 1982, Carl H.
  1535.    Meyer & Stephen M. Matyas.
  1536.  
  1537.    [DES] -  Data Encryption Standard, United States of America,
  1538.    Department of Commerce, National Institute of Standards and
  1539.    Technology, Federal Information Processing Standard (FIPS) 46-1.
  1540.    - Data Encryption Algorithm, American National Standards Institute,
  1541.    ANSI X3.92-1981.
  1542.    (See also FIPS 112, Password Usage, which includes FORTRAN code for
  1543.    performing DES.)
  1544.  
  1545.    [DES MODES] - DES Modes of Operation, United States of America,
  1546.    Department of Commerce, National Institute of Standards and
  1547.    Technology, Federal Information Processing Standard (FIPS) 81.
  1548.    - Data Encryption Algorithm - Modes of Operation, American National
  1549.    Standards Institute, ANSI X3.106-1983.
  1550.  
  1551.    [D-H] - New Directions in Cryptography, IEEE Transactions on
  1552.    Information Technology, November, 1976, Whitfield Diffie and Martin
  1553.    E. Hellman.
  1554.  
  1555.    [DoD] - Password Management Guideline, United States of America,
  1556.    Department of Defense, Computer Security Center, CSC-STD-002-85.
  1557.    (See also FIPS 112, Password Usage, which incorporates CSC-STD-002-85
  1558.    as one of its appendicies.)
  1559.  
  1560.    [KNUTH] - The Art of Computer Programming, Volume 2: Seminumerical
  1561.    Algorithms, Chapter 3: Random Numbers. Addison Wesley Publishing
  1562.    Company, Second Edition 1982, Donald E. Knuth.
  1563.  
  1564.  
  1565. D. Eastlake, S. Crocker, & J. Schiller                         [Page 27]
  1566.  
  1567.  
  1568. INTERNET-DRAFT                      Randomness Requirements for Security
  1569.  
  1570.  
  1571.    [MD2] - The MD2 Message-Digest Algorithm, RFC1319, April 1992, B.
  1572.    Kaliski
  1573.    [MD4] - The MD4 Message-Digest Algorithm, RFC1320, April 1992, R.
  1574.    Rivest
  1575.    [MD5] - The MD5 Message-Digest Algorithm, RFC1321, April 1992, R.
  1576.    Rivest
  1577.  
  1578.    [SHANNON] - The Mathematical Theory of Communication, University of
  1579.    Illinois Press, 1963, Claude E. Shannon.  (originally from:  Bell
  1580.    System Technical Journal, July and October 1948)
  1581.  
  1582.    [SHIFT1] - Shift Register Sequences, Aegean Park Press, Revised
  1583.    Edition 1982, Solomon W. Golomb.
  1584.  
  1585.    [SHIFT2] - Cryptanalysis of Shift-Register Generated Stream Cypher
  1586.    Systems, Aegean Park Press, 1984, Wayne G. Barker.
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623. D. Eastlake, S. Crocker, & J. Schiller                         [Page 28]
  1624.  
  1625.  
  1626. INTERNET-DRAFT                      Randomness Requirements for Security
  1627.  
  1628.  
  1629. Authors Addresses
  1630.  
  1631.    Donald E. Eastlake 3rd
  1632.    Digital Equipment Corporation
  1633.    550 King Street, LKG2-1/BB3
  1634.    Littleton, MA 01460
  1635.  
  1636.    Telephone:   +1 508 486 6577(w)  +1 508 287 4877(h)
  1637.    EMail:       dee@skidrow.lkg.dec.com
  1638.    NIC Handle:  [DEE]
  1639.  
  1640.  
  1641.    Stephen D. Crocker
  1642.    Trusted Information Systems, Inc.
  1643.    3060 Washington Road
  1644.    Glenwood, MD 21738
  1645.  
  1646.    Telephone:   +1 301 854 6889
  1647.    EMail:       crocker@tis.com
  1648.    NIC Handle:  [SDC1]
  1649.  
  1650.    Jeffrey I. Schiller
  1651.    Massachusetts Institute of Technology
  1652.    77 Massachusetts Avenue
  1653.    Cambridge, MA 02139
  1654.  
  1655.    Telephone:   +1 617 253 0161
  1656.    EMail:       jis@mit.edu
  1657.    NIC Handle:  [JIS]
  1658.  
  1659.  
  1660.  
  1661. Expiration and File Name
  1662.  
  1663.    This draft expires 31 March 1994.
  1664.  
  1665.    Its file name is draft-ietf-security-randomness-01.txt.
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681. D. Eastlake, S. Crocker, & J. Schiller                         [Page 29]
  1682.  
  1683.  
  1684. %%% overflow headers %%%
  1685. Cc: David M. Balenson <balenson@tis.com>, Stephen D. Crocker <crocker@tis.com>,
  1686.         Beast (Donald E. Eastlake,III) <dee@skidrow.lkg.dec.com>,
  1687.         Carl Ellison <cme@ellisun.sw.stratus.com>,
  1688.         Neil Haller <nmh@thumper.bellcore.com>, Marc Horowitz <marc@mit.edu>,
  1689.         Charlie Kaufman <kaufman@abyss.enet.dec.com>,
  1690.         Steve Kent <kent@bbn.com>, Hal Murray <murray@decsrc.enet.dec.com>,
  1691.         Richard Pitkin <pitkin@ranger.enet.dec.com>,
  1692.         Tim Redmond <redmond@tis.com>, Jeffrey I. Schiller <jis@mit.edu>,
  1693.         Doug Tygar <doug.tygar@cs.cmu.edu>,
  1694.         Eirikur Hallgrimsson <eirikur@ranger.enet.dec.com>,
  1695.         Al Kent <arkent@world.std.com>,
  1696.         Jim Burrows (Brons) <burrows@brons.enet.dec.com>
  1697. %%% end overflow headers %%%
  1698.